import {QuestionCheckboxPropsType, QuestionCheckboxDefaultProps} from "./interface";
import {Checkbox, Space, Typography} from "antd";

const {Paragraph} = Typography
export const Component = (props: QuestionCheckboxPropsType) => {
    const {title, isVertical, list = []} = {...QuestionCheckboxDefaultProps, ...props};

    return (
        <div>
            <Paragraph strong>{title}</Paragraph>
            <div>
                <Space direction={isVertical ? 'vertical' : 'horizontal'}>
                    {list.map(item => {
                        const {value, text, checked} = item
                        return <Checkbox value={value} key={value} checked={checked}>{text}</Checkbox>
                    })}
                </Space>
            </div>
        </div>
    );
};
